/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package queenb.web.store;

import java.sql.Date;
import java.sql.SQLException;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import oracle.jdbc.OracleTypes;
import queenb.net.datacontrol.DataStatement;
import queenb.net.datacontrol.Param;
import queenb.net.entitybean.C050;
import queenb.web.util.PackageContants;

/**
 *
 * @author Nguyen Hung
 */
public class C050Store extends C050{
     public int updateC050(int pnPC050, int pnFH000, int pnFH200,String pvCV051, String pvCV052, Date pdCD053, Date pdCD054, String pvLOGIN) {
        try {
            DataStatement updateStatement = new DataStatement(PackageContants.UPDATE_C050, OracleTypes.INTEGER, new Param[]{
                        new Param(OracleTypes.INTEGER, pnPC050),
                        new Param(OracleTypes.INTEGER, pnFH000),
                        new Param(OracleTypes.INTEGER, pnFH200),
                         new Param(OracleTypes.CHAR, pvCV051),
                        new Param(OracleTypes.CHAR, pvCV052),
                        new Param(OracleTypes.DATE, pdCD053),
                        new Param(OracleTypes.DATE, pdCD054),
                        new Param(OracleTypes.CHAR, pvLOGIN)});
            return super.update(updateStatement, C050.class);
        } catch (SQLException ex) {
            Logger.getLogger(C050Store.class.getName()).log(Level.SEVERE, null, ex);
            return -1;
        }

    } 
     public int deleteC050(int pnPC050, String pvLOGIN) {
        try {
            DataStatement dataStatement = new DataStatement(PackageContants.DELETE_C050, OracleTypes.INTEGER, new Param[]{
                        new Param(OracleTypes.INTEGER, pnPC050),
                        new Param(OracleTypes.CHAR, pvLOGIN)
                    });
            return super.update(dataStatement, C050.class);
        } catch (SQLException ex) {
            Logger.getLogger(C050Store.class.getName()).log(Level.SEVERE, null, ex);
            return -1;
        }

    }

     public List<C050> getListC050(int pnFH000, int pnFH200, Date pdCD053, Date pdCD054,String pvLOGIN) throws SQLException, InstantiationException, IllegalAccessException {
        DataStatement dataStatement = new DataStatement(PackageContants.LIST_C050, OracleTypes.CURSOR, new Param[]{
                    new Param(OracleTypes.INTEGER, pnFH000),
                    new Param(OracleTypes.INTEGER, pnFH200),
                    new Param(OracleTypes.DATE, pdCD053),
                    new Param(OracleTypes.DATE, pdCD054),
                    new Param(OracleTypes.CHAR, pvLOGIN)
                });
        return super.find(dataStatement, C050.class);
    }
    
}
